<template>
  <!-- 原材默认类型设置 -->
  <div class="rawMaterialType">
    <el-form ref="form" :model="form" :rules="rules">
      <el-row>
        <el-col :span="24">
          <div class="header">原材直径12和14的默认类型设置:</div>
        </el-col>
        <el-col :span="24">
          <el-form-item prop="workArea">
            <el-radio-group v-model="form.workArea" style="width: 50%">
              <el-row>
                <el-col :span="12">
                  <el-radio style="margin: 10px 0" label="1">系统默认类型</el-radio>
                </el-col>
                <el-col :span="12">
                  <el-radio style="margin: 10px 0" label="2">自选默认类型</el-radio>
                </el-col>
              </el-row>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="form.workArea === '2'" style="margin-bottom: 20px;">
          <el-table
            ref="multipleTable"
            :data="tableData"
            tooltip-effect="dark"
            style="width: 100%"
            v-loading="loading"
          >
            <el-table-column label="序号" width="55" align="center">
              <template slot-scope="scope">{{ scope.$index + 1 }}</template>
            </el-table-column>
            <el-table-column
              prop="name"
              label="直径"
              align="center"
            ></el-table-column>
            <el-table-column label="默认类型" align="center">
              <template slot-scope="scope">
                <el-select v-model="scope.row.value" placeholder="请选择">
                  <el-option label="线材" value="1"> </el-option>
                  <el-option label="棒材" value="2"> </el-option>
                </el-select>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
        <el-col :span="24">
          <div class="tips">
            提示：此处只影响默认钢筋类型，并非最终加工钢筋类型。
          </div>
        </el-col>
      </el-row>
    </el-form>
    <div class="submitForm">
      <el-button type="primary" @click="submitForm">保存</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "RawMaterialType",
  components: {},
  props: {},
  data() {
    return {
      form: {
        workArea: "1",
      },
      rules: {
        workArea: [{ required: true, message: "不能为空", trigger: "blur" }],
      },
      loading: false,
      tableData: [
        {
          name: "12",
          value: "1",
        },
        {
          name: "14",
          value: "2",
        },
      ],
    };
  },
  filters: {},
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  beforeDestroy() {},
  methods: {
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          console.log(this.form);
          console.log(this.tableData);
        }
      });
    },
  },
};
</script>

<style scoped lang="scss">
.rawMaterialType {
  width: 50%;
}
</style>
